﻿<cfsilent>
	<cfscript>
		
		event.setArg("pageTitle", "网上成绩录入 - 处理成绩解锁申请");
		
		datetimeAdvice = getProperty("serviceFactory").getBean("datetimeAdvice");
		stringAdvice = getProperty("serviceFactory").getBean("stringAdvice");
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		
		termId = event.getArg("TID", event.getArg("TermID"));
		academicYear = event.getArg("AcademicYear");
		academicTerm = event.getArg("AcademicTerm");
		
		signId = event.getArg("REQ");
		
		currentTab = event.getArg("TabID", "labHistory");
		
		rs_signEntity = queryNew("sign_id");
		
		passArgs = structNew();
		
		if ( len(signId) ) {
			
			sql = "	SELECT
						tmu.sign_id,
						t.tch_name,
						tmu.date_created,
						tmu.sign_reason,
						tmu.sign_status
					FROM
						t_task_mark_unlock tmu INNER JOIN t_teacher t ON t.tch_id = tmu.sign_user_id
					WHERE
						tmu.sign_id = :signId ";
			
			queryObj = new Query(datasource = application.dnsSlave);
			queryObj.addParam(name = "signId", value = signId, cfsqltype = "cf_sql_char");
			rs_signEntity = queryObj.execute(sql = sql).getResult();
		
			currentTab = "labRequest";
		}
		
		sql = "	SELECT
					tmu.sign_id,c.course_name,t.tch_name,
					tmu.sign_status,tmu.date_created,tmu.sign_reason,am.tch_name admin_tch_name,
					tmu.date_review
				FROM
					t_task_mark_unlock tmu INNER JOIN t_course c ON c.cid = tmu.cid INNER JOIN t_teacher t ON t.tch_id = tmu.sign_user_id
					INNER JOIN t_teacher am ON am.tch_id = tmu.admin_user_id
				WHERE
					tmu.term_id = :termId 
				ORDER BY
					tmu.sign_id DESC";
		
		queryObj = new Query(datasource = application.dnsSlave);
		queryObj.addParam(name = "termId", value = termId, cfsqltype = "cf_sql_char");
		rs_sign = queryObj.execute(sql = sql).getResult();
		
	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">网上成绩录入</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 application"></i><cfoutput>#academicYear#</cfoutput>-<cfoutput>#academicTerm#</cfoutput>学期成绩任务解锁
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<cfif rs_signEntity.recordCount>
							<span <cfif currentTab eq "labRequest">class="active"</cfif> id="labRequest" tabTarget="Request">申请内容</span>
						</cfif>
						<span <cfif currentTab eq "labHistory">class="active"</cfif> id="labHistory" tabTarget="History">申请历史记录</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				
				<cfif rs_signEntity.recordCount>
					
					<cfset structInsert( passArgs, "REQ", signId, true) />
					
					<div id="Request" class="tabContent">
						
						<div class="noticeBlock">
							
							<h3>教学班成绩解锁申请</h3>
							<p>
								<span class="img icon16x16 message"></span>
								成绩解锁申请, 执行序号 <b><cfoutput>#rs_signEntity.sign_id#</cfoutput></b>
							</p>
							<hr/>
						</div>
						
						<div class="UIDashBoard">
							<div class="col2">
								<div class="noticeBlock">
									<p>学院申请变更</p>
									<ol>
										<li>申请人: <cfoutput>#rs_signEntity.tch_name#</cfoutput></li>
										<li>提交时间: <cfoutput>#datetimeAdvice.formatDateString( rs_signEntity.date_created, "YYYY年MM月DD日" )#</cfoutput></li>
										<li>变更原因: <cfoutput>#stringAdvice.XHTMLSafeFormat( rs_signEntity.sign_reason )#</cfoutput></li>
										<li>状态: <cfoutput>#dictAdvice.getProgressStatus( rs_signEntity.sign_status )#</cfoutput></li>
									</ol>
								</div>
							</div>
							<div class="col2 last">
								<div class="noticeBlock">
									<p>申请回执单号</p>
									<p>
										<span class="img icon16x16 message"></span>
										该回执单号仅用于核查工作流信息
									</p>
									<br/>
									<p><img src="<cfoutput>#getContextRoot()#</cfoutput>/barcode/Print/PRGS-MUK-<cfoutput>#rs_signEntity.sign_id#</cfoutput>.png"  height="43"/></p>
								</div>
							</div>
						</div>
						
						<div class="clearfix"></div>
						
						<cfif rs_signEntity.sign_status eq "W">
							
							<form id="formSign" onSubmit="javascript:return processVerfiyForm('formSign');" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('taskClassSignApproveDo')#</cfoutput>">
								
								<input name="REQ" type="hidden" value="<cfoutput>#signId#</cfoutput>" />
								
								<div class="lable">
									<input class="button" type="submit" value="同意" />
									<a href="<cfoutput>#buildURL('taskClassSignRejectDo', passArgs)#</cfoutput>" class="button2">拒绝</a>
								</div>
								
							</form>
							
						</cfif>
						
					</div>
					
				</cfif>
				
				<div id="History" class="tabContent">
						
					<div class="noticeBlock">
						<h3>教学班成绩修订申请 历史记录</h3>
						<hr/>
					</div>
					
					<cfif rs_sign.recordCount>
							
							<cfset row = 0 />
							<table class="UIEditable">
								<thead>
									<tr>
										<td width="18"></td>
										<td width="60">申请人</td>
										<td width="140">课程</td>
										<td>修订原因</td>
										<td width="60">审批进程</td>
										<td width="70">申请时间</td>
										<td width="18"></td>
									</tr>
								</thead>
								<tbody>
                                    <cfloop query="rs_sign">
										<cfset row ++ />
										<cfset structInsert(passArgs, "REQ", rs_sign.sign_id, true) />
										<tr class="editRows <cfif event.getArg('REQ') eq rs_sign.sign_id> lastEdited</cfif>">
											<td><span class="index"><cfoutput>#row#</cfoutput></span></td>
											<td><cfoutput>#rs_sign.tch_name#</cfoutput></td>
											<td><cfoutput>#rs_sign.course_name#</cfoutput></td>
											<td><cfoutput>#stringAdvice.XHTMLSafeFormat( rs_sign.sign_reason )#</cfoutput></td>
											<td><cfoutput>#dictAdvice.getProgressStatus( rs_sign.sign_status )#</cfoutput></td>
											<td><span class="numeric"><cfoutput>#datetimeAdvice.formatDateString( rs_sign.date_created, "YYYY/MM/DD" )#</cfoutput></span></td>
											<td><a class="stat info" href="<cfoutput>#buildURL('taskClassSignProve', passArgs)#</cfoutput>"></a></td>
										</tr>
									</cfloop>
								</tbody>
							</table>

						<cfelse>
							<div class="systemNotice">
								<p>没有需要处理的成绩解锁申请</p>
							</div>
						
					</cfif>
				
				</div>
				
			</div>
		</li>
	</ul>
</div>